package forCreateFile;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.TimerTask;

public class CreateFileTask extends TimerTask{

	@Override
	public void run() {
		System.out.println("生成文件任务开始执行");
		try {
			PrintWriter  pw =  new PrintWriter(new BufferedWriter(new FileWriter(
					new File("D:/source/"+System.currentTimeMillis()+".txt"))));
			pw.println("~~!!!aaaEERO*<.,}|这是用来测试的"+System.currentTimeMillis());
			pw.flush();
			pw.close();
			System.out.println("生成文件成功,本次结束");
		} catch (Exception e) {
			e.printStackTrace();
		} 
	}

}
